#include <Windows.h>
#include <vector>

#include "..\cr\NeuralNet.h"

using namespace std;
int APIENTRY SolveChar(byte* _input, double* _output, int _lenght)
{
	CNeuralNet net(string("weights.dat"));

	vector<double> inputs;
	for(int i= 0; i < _lenght; i++)
		inputs.push_back(_input[i]);

	vector<double> res = net.Solve(inputs);
	//net.SoftMax(res);
	
	// Procura o melhor resultado
	double biggerVal = res[0];
	int idx = 0;
	for(int i = 1; i < net.NumOutputs(); i++)
	{
		if( res[i] > biggerVal)
		{
			biggerVal = res[i];
			idx =i;
		}
	}

	*_output = biggerVal;
	return idx;
}

BOOL APIENTRY DllMain( HMODULE hModule,
	DWORD  ul_reason_for_call,
	LPVOID lpReserved
	)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		break;
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}